import { createApp } from "vue";
import { appoptions } from "./appoptions";
//@ts-ignore
import "./error-alert.ts";
//@ts-ignore
import { guid } from "./guid.ts";

// console.log(app);
("use strict");
export const initloadingid = "first-" + guid();
export { vueApp };

const vueApp = (() => {
    // if (process.env.PRERENDER && process.env.NODE_ENV !== "development") {
    //     return createSSRApp(appoptions);
    // } else {
    return createApp(appoptions);
    // }
})();

console.log(vueApp);
vueApp.config.errorHandler = function (err) {
    console.error(err);
    throw err;
};
export function mount(el: Element) {
    // console.log("config", config);

    let elementroot =
        document.getElementById("app") ||
        el.appendChild(document.createElement("div"));
    Object.assign(elementroot, {
        id: "app",
    });
    const vm = vueApp.mount(elementroot);
    console.log(vm);
    Object.assign(vm.$el, {
        id: "app",
    });
}
